<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<link rel="stylesheet" type="text/css" href="__PUBLIC__/home/css/style.css"/>
		<link rel="stylesheet" type="text/css" href="__PUBLIC__/home/css/reset.css"/>
		<link rel="stylesheet" href="__PUBLIC__/home/css/qqFace.css">
		<script src="__PUBLIC__/home/js/jquery.min.js" type="text/javascript"></script>
		<title></title>
        <style type="text/css">

        </style>
	</head>
	<body>
		<div class="wrapper">
			<!--头部-->
			{include file="public:head" /}
			<div class="content">
				<!--直播预告-->
				{include file="public:live" /}
				<div class="overflow">
					<!--视频直播-->
					{include file="public:movie" /}
					<div class="con_right dis_in">
						<div class="chat_box">
							<ul class="chat_nav">
								<li id="hd_li"><span class="ok cursor"  id="hd">互动聊天</span></li>
								<li id="wz_li"><span class="no cursor"  id="wz">文字同步直播</span></li>
							</ul>
							<div class="chat_con_box1" id="chat_box1" style="display:block;" >
								<div class="chat_b1">
									<div class="messageBox">
										<div id="message">

										</div>
									</div>
									<div class="chat_btm_bg">
										<div class="sh_btn">
											<input type="button" name="" id="sh"  value="审核" />
											<input type="button" name="" id="no_go" value="不通过" />
										</div>

										<img src="__PUBLIC__/home/images/icon_bl.png"/>
									</div>
								</div>
								 <div class="function_bar">
								<div class="fun_box">
									<ul>
										<li><span class="clear" title="清空"><img src="__PUBLIC__/home/images/icon_delete.png"/></span></li>
										<li><span class="emotion" title="表情"><img src="__PUBLIC__/home/images/icon_face.png"/></span></li>
										<li style="position: relative"><span><img src="__PUBLIC__/home/images/icon_pic.png"/></span><input type="file" id="fileId" value="UploadImage" name="image" /></li>
									</ul>
									<div class="qq_box">
										<img src="__PUBLIC__/home/images/icon_qq.png"/>
										<span>QQ交谈</span>
									</div>
								</div>
								<div class="inp_box">
									<div class="inp_inp dis_b" id="content" contenteditable="true"></div>
									<p class="fly"><img src="__PUBLIC__/home/images/iocn_n.png"/>飞屏</p>
									<input class="inp_inp1" type="button" name="" id="sendMessage" value="发送" />
								</div>
							 </div>
							</div>
							<div class="chat_con_box2" id="chat_box2" style="display:none;">
								<div class="chat_b1">
									<div class="messageLiveBox">
										<div id="messageLive"></div>
									</div>
								</div>
								<div class="function_bar">
									<div class="fun_box">
										<ul>
											<li><span class="emotionLive" title="表情"><img src="__PUBLIC__/home/images/icon_face.png"/></span></li>
											<li style="position: relative"><span><img src="__PUBLIC__/home/images/icon_pic.png"/></span><input type="file" id="fileIdLive" value="UploadImage" name="image" /></li>
										</ul>
									</div>
									<div class="inp_box">
										<div class="inp_inp dis_b" id="contentLive" contenteditable="true"></div>
										<input class="inp_inp1" type="button" name="" onclick="sendLiveMessage()" id="sendMessageLive" value="发送" />

									</div>
								</div>
							</div>
							<div id="fly_notice" style="width: 100%;font-size: 14px;color:#000;position: absolute;top:10%;right:-30%;" class="fly_notice">
								<div class="remind" style="position: absolute;left: 70%;">
									<img class="icon_fly" src="__PUBLIC__/home/images/icon_fly.png"/>
									<span class="re_sp">提醒刚进来的游客朋友</span>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
			<div class="footer">
				<span class="foot_sp">投资有风险，入市需谨慎</span>
				<span class="foot_sp1">免责声明</span>
			</div>
		</div>
		{include file="public:window" /}
		<div class="popup hide1" id="popup">

		</div>
		<script type="text/javascript" src="__PUBLIC__/home/js/jquery.qqFace.js"></script>
		<script type="text/javascript" src="__PUBLIC__/home/js/jquery-browser.js"></script>
		<script type="text/javascript" src="__PUBLIC__/home/js/base.js"></script>
		<script type="text/javascript" src="__PUBLIC__/home/js/user.js"></script>
		<script type="text/javascript" src="__PUBLIC__/home/js/chart.js"></script>
		<script src="__PUBLIC__/home/js/ajaxfileupload.js" type="text/javascript"></script>
		<script>
			var _hv678videoarea = "videoarea";
			var _hv678usercode = "";
			var _hv678username = "";
			(function() {
				var hp = document.createElement("script");
				hp.src = "http://jsjr.hv678.com/room/script/playerchat/9621d2d944c34ac6ba9a8501c1ebc3e6"
				var s = document.getElementsByTagName("script")[0];
				s.parentNode.insertBefore(hp, s);
			})();
		</script>
		<script>

			$(function () {
				$(".nav_ul li").addClass("hide1");
				$(".fly").on("click", function () {
					if($(this).hasClass("on")){
						$(this).removeClass("on");
						$(this).children("img").attr("src","__PUBLIC__/home/images/iocn_n.png")
					}else{
						$(this).addClass("on");
						$(this).children("img").attr("src","__PUBLIC__/home/images/icon_c.png")
					};
				});
				$('.emotionLive').qqFace({
					assign:'contentLive',
					path:'__PUBLIC__/home/face/'	//表情存放的路径
				});
				//获取聊天记录&quot
				$.ajax({
					url:"http://zbstest.guochengic.com/home/Chat/getChat",
					type:"POST",
					success: function (res) {
						console.log(res)
						if(res.code==0){
							var html="";
							if(res.data.is_verify.length>0){
								for(var i= (res.data.is_verify.length-1);i >= 0; i-- ){
									var messageData=res.data.is_verify[i];
									var message=JSON.parse(messageData.content);
									var uid=$("#userId").attr("data-id");
									var imgSrc=src(message.identity);
									if(messageData.status==1){
										if(message.uid!=uid){
											html += '<div class="chat_con" data-id="'+messageData.id+'">' +
													'<p class="chat_p">' +
													'<img class="icon_zl" src='+imgSrc+'>' +
													'<span class="uid zl_name" data-id="'+message.uid+'" onclick="reply(this)">'+message.nickname+'</span>' +
													'<span class="sendTime">'+message.sendTime+'</span>' +
													'</p>';
											if(message.identity==1){
												html+='<span class="zl_con dis_in message_content">'+message.content+'</span></div>';
											}else {
												html+='<span class="yk_con  dis_in message_content">'+message.content+'</span></div>';
											};
										}else {
											html += '<div class="chat_con chat_right" data-id="'+messageData.id+'">' +
													'<p class="chat_p">' +
													'<img class="icon_zl" src='+imgSrc+'>' +
													'<span class="uid zl_name" data-id="'+message.uid+'" onclick="reply(this)">'+message.nickname+'</span>' +
													'<span class="sendTime">'+message.sendTime+'</span>' +
													'</p>';
											if(message.identity==1){
												html+='<span class="zl_con dis_in message_content">'+message.content+'</span></div>';
											}else {
												html+='<span class="yk_con  dis_in message_content">'+message.content+'</span></div>';
											};
										}
									};
								};
							}
							if(res.data.is_not_verify.length>0){
								for(var i = (res.data.is_not_verify.length-1); i >= 0; i--){
									var messageData=res.data.is_not_verify[i];
									var message=JSON.parse(messageData.content);
									var uid=$("#userId").attr("data-id");
									var imgSrc=src(message.identity);
									if(messageData.status==0){
										if(message.uid!=uid){
											html += '<div class="chat_con audit" data-id="'+messageData.id+'">' +
													'<p class="chat_p">' +
													'<img class="icon_zl" data-identity="'+message.identity+'" src='+imgSrc+'>' +
													'<span class="uid zl_name" data-id="'+message.uid+'" onclick="reply(this)">'+message.nickname+'</span>' +
													'<span class="sendTime">'+message.sendTime+'</span>' +
													'</p>';
											if(message.identity==1){
												html+='<span class="zl_con dis_in message_content">'+message.content+'</span><span class="sh">审核</span></div>';
											}else {
												html+='<span class="yk_con  dis_in message_content">'+message.content+'</span><span class="sh">审核</span></div>';
											};
										}
									};
								}
							}
							$("#message").append(html);
							var _height=$('#message')[0].scrollHeight;
							$(".messageBox").animate({scrollTop:_height+'px'},500);
						}
					}
				});
				$("#wz_li").click(function () {
					var html="";
					$.ajax({
						url:"http://zbstest.guochengic.com/home/chat/getTextChat",
						type:"POST",
						success: function (res) {
							console.log(res)
							if(res.code==0){
								for (var i=0;i<res.data.length;i++){
									var messageData=res.data[i];
									var message=JSON.parse(messageData.content);
									var uid=$("#userId").attr("data-id");
									var imgSrc=src(message.identity);
									if(message.uid!=uid){
										html += '<div class="chat_con">' +
												'<p class="chat_p">' +
												'<img class="icon_zl" src='+imgSrc+'>' +
												'<span class="uid zl_name" data-id="'+message.uid+'">'+message.nickname+'</span>' +
												'<span class="sendTime">'+message.sendTime+'</span>' +
												'</p>'+
												'<span class="zl_con dis_in">'+message.content+'</span></div>';
									}else {
										html += '<div class="chat_con chat_right">' +
												'<p class="chat_p">' +
												'<img class="icon_zl" src='+imgSrc+'>' +
												'<span class="uid zl_name" data-id="'+message.uid+'">'+message.nickname+'</span>' +
												'<span class="sendTime">'+message.sendTime+'</span>' +
												'</p>'+
												'<span class="zl_con dis_in">'+message.content+'</span></div>';
									};
								}
								$("#messageLive").html(html);
								var _height=$('#messageLive')[0].scrollHeight;
								$(".messageLiveBox").animate({scrollTop:_height+'px'},500);
							}
						}
					})
				});
			});
			//qq表情
			$(function(){
				$('.emotion').qqFace({
					assign:'content',
					path:'__PUBLIC__/home/face/'	//表情存放的路径
				});
				$("#userLogin").click(function () {
					$(".userLogin").show();
				});
				$("#register").on("click", function () {
					$(".userRegister").show();
				});
				$(".forget").on("click", function () {
					$(".forgetPassword").show();
					$(".userLogin").hide();
				});
				$(".clear").click(function () {
					$("#message").empty();
				});
			});
			function replace_em(str){
				str = str.replace(/\</g,'&lt;');
				str = str.replace(/\>/g,'&gt;');
				str = str.replace(/\n/g,'<br/>');
				str = str.replace(/\[em_([0-9]*)\]/g,'<img src="__PUBLIC__/home/face/$1.gif" border="0" />');
				return str;
			}
			//		表情结束
			ws = new WebSocket("ws://139.196.38.101:2346");
			ws.onopen = function() {
				console.log('连接成功');
			}
			ws.onmessage = function(e) {
				var message=JSON.parse(e.data);
				var imgSrc=src(message.identity);
				if(message.status==0){
					var html = '<div class="chat_con audit" data-id="'+message.chatId+'">' +
							'<p class="chat_p">' +
							'<img class="icon_zl" data-identity="'+message.identity+'" src="'+imgSrc+'"/>' +
							'<span class="uid zl_name" data-id="'+message.uid+'" onclick="reply(this)">'+message.nickname+'</span>' +
							'<span class="sendTime">'+message.sendTime+'</span>' +
							'</p>' +
							'<span class="yk_con dis_in message_content">'+message.content+'</span><span class="sh">审核</span></div>';
				}else if(message.status==1){
					return;
				}else if(message.status==2){
					var html = '<div class="chat_con audit "><p class="chat_p"><img class="icon_zl" src="__PUBLIC__/home/images/icon_zl.png"/><span class="zl_name" data-id="'+message.uid+'">'+message.nickname+'</span><span>'+message.sendTime+'</span></p><span class="zl_con dis_b">'+message.content+'</span><span class="sh">审核不通过</span></div>';
				}
				if(message.status==4){
					var content=message.content;
					flystart(content)
				}
				$("#message").append(html);
				var uid=$("#userId").attr("data-id");
				if(message.content.indexOf(uid)!=-1){
					var uid=$("#userId").attr("data-id");
					var nickname=$(".nickname").html();
					var identity=$("#userId").attr("data-type");
					var sendTime=getDate();
					var imgSrc=src(identity);
					var myMessage="<div class='chat_con chat_right chat_right_color'>"+
							"<p class='chat_p'><img class='icon_zl' src='"+imgSrc+"'/><span class='zl_name uid' data-id='"+uid+"'>"+nickname+"</span><span class='sendTime'>"+sendTime+"</span></p>";
					myMessage+='<span class="zl_con yk_r dis_in"><span style="color:red">有人@我</span>'+message.nickname+":"+message.content+'</span></div>';
					$("#message").append(myMessage);
				}
			};
			$("#content").keydown(function (event) {
				event = event || window.event;
				var keyCode = event.keyCode;
				//根据keycode判断按下的是哪个键
				if(keyCode=='13'){
					if($(".fly").hasClass("on")){
						sendMessage(4);
					}else {
						sendMessage(1);
					}
					event.returnValue = false;
					return false;
				}
			});
			$("#sh").click(function(){
				if($(".audit").length<=0){return;}
				var first=$(".audit").eq(0);
				var uid = first.find(".uid").attr("data-id");
				var nickname = first.find(".uid").html();
				var sendTime = first.find(".sendTime").html();
				var content = first.find(".message_content").html();
				var identity = first.find("img").attr("data-identity");
				var status = 1;
				var chatId=first.attr("data-id");
				var message = JSON.stringify({"content":content,"status":status,"uid":uid,"nickname":nickname,"identity":identity,"sendTime":sendTime,"chatId":chatId});
				$.ajax({
					url:"http://zbstest.guochengic.com/home/Chat/verify",
					type:"POST",
					data:{
						'chat_id':chatId,
						'status':1
					},
					success: function (res) {
						console.log(res)
						if(res.code==0){
							first.find(".sh").hide();
							first.removeClass("audit");
							console.log(message)
							ws.send(message);
							var top=first[0].offsetTop;
							$(".messageBox").animate({scrollTop:top+'px'},500);
						}else {
							$("#errmsg").html(res.msg);
							$("#error").show();
							errorHide();
							return;
						}
					}
				});
			});
			$("#no_go").click(function () {
				if($(".audit").length<=0){return;}
				var first=$(".audit").eq(0);
				var uid = first.find(".uid").attr("data-id");
				var nickname = first.find(".uid").html();
				var sendTime = first.find(".sendTime").html();
				var content = first.find(".zl_con.dis_in").html();
				var identity = first.find("img").attr("data-identity");
				var status = 2;
				var chatId=first.attr("data-id");
				var message = JSON.stringify({"content":content,"status":status,"uid":uid,"nickname":nickname,"identity":identity,"sendTime":sendTime,"chatId":chatId});
				$.ajax({
					url:"http://zbstest.guochengic.com/home/Chat/verify",
					type:"POST",
					data:{
						'chat_id':chatId,
						'status':2
					},
					success: function (res) {
						console.log(res)
						if(res.code==0){
							first.find(".sh").html("不通过");
							first.removeClass("audit");
							var top=first[0].offsetTop;
							$(".messageBox").animate({scrollTop:top+'px'},500);
						}else {
							$("#errmsg").html(res.msg);
							$("#error").show();
							errorHide();
							return;
						}
					}
				});
			});
			$("#sendMessage").click(function () {
				if($(".fly").hasClass("on")){
					var status=4;
					sendMessage(status);
				}else {
					var status=1;
					sendMessage(status);
				}
			});
			//文件上传
			var flag=true;
			$("#fileId").change(function () {
				if(flag){
					flag=false;
					ajaxFileUpload();
				}

			});
			function fileChange(){
				var imagSize =  document.getElementById("fileId").files[0].size;
				if(imagSize>1024*100){
					alert("图片大小在100kb以内，为："+imagSize/(1024)+"kb");
					location.reload();
					return;
				};
				var imgFile = new FileReader();
				imgFile.readAsDataURL(document.getElementById('fileId').files[0]);
				imgFile.onload = function () {
					var imgData = this.result; //base64数据
					ajaxFileUpload(imgData);
				};
			}
			function ajaxFileUpload() {
				$.ajaxFileUpload
				(
						{
							url: "http://zbstest.guochengic.com/home/upload/upload", //用于文件上传的服务器端请求地址
							secureuri: false, //是否需要安全协议，一般设置为false
							fileElementId: 'fileId', //文件上传域的ID
							dataType:'post',
							success: function (data)  //服务器成功响应处理函数
							{
								flag=true;

									var url = data;
									var content = "<img src='"+url+"'>";
									var uid=$("#userId").attr("data-id");
									var nickname=$(".nickname").html();
									var identity=$("#userId").attr("data-type");
									var sendTime=getDate();
									var imgSrc=src(identity);
									$("#content").html("");
									var message = JSON.stringify({"content":content,"status":1,"uid":uid,"nickname":nickname,"identity":identity,"sendTime":sendTime});
									$.ajax({
										url:"http://zbstest.guochengic.com/home/Chat/addChat",
										type:"POST",
										data:{
											content:message
										},
										success: function (res) {
											if(res.code==0){
												var chatId=res.data.chat_id;
												var message = JSON.stringify({"content":content,"status":1,"uid":uid,"nickname":nickname,"identity":identity,"sendTime":sendTime,"chatId":chatId});
												var myContent=JSON.parse(message);
												var myMessage="<div class='chat_con chat_right' data-id='"+chatId+"'>"+
														"<p class='chat_p'><img class='icon_zl' src='"+imgSrc+"'/><span class='zl_name uid' data-id='"+uid+"'>"+nickname+"</span><span class='sendTime'>"+sendTime+"</span></p>"+
														"<span class='yk_con yk_r dis_in'>"+myContent.content+"</span>"+
														"</div>";
												ws.send(message);
												$("#message").append(myMessage);
												var _height=$('#message')[0].scrollHeight;
												$(".messageBox").animate({scrollTop:_height+'px'},500);
												$.ajax({
													url:"http://zbstest.guochengic.com/home/Chat/verify",
													type:"POST",
													data:{
														'chat_id':chatId
													},
													success: function (res) {
														if(res.code==0){

														}else {
															$("#errmsg").html(res.msg);
															$("#error").show();
															errorHide();
															return;
														}
													}
												});
											}else {
												$("#errmsg").html(res.msg);
												$("#error").show();
												errorHide();

											}
										}
									});

							}

						}
				)
				return false;
			}
			function src(data){
				var imgSrc="";
				if(data=="tourist"){
					imgSrc="__PUBLIC__/home/images/icon_yk_big.png";
				}else if(data=="3"){
					imgSrc="__PUBLIC__/home/images/icon_hy.png";
				}else if(data=="1"){
					imgSrc="__PUBLIC__/home/images/icon_zl.png";
				}else if(data=="2"){
					imgSrc="__PUBLIC__/home/images/icon_zl.png";
				}else{
					imgSrc="__PUBLIC__/home/images/icon_yk_big.png";
				}
				return imgSrc;
			};
			function sendMessage(num){
				var status=num;
				var _content = $("#content").html();
				var content = $.trim(_content.replace(/&nbsp;/ig,' ')); // 用jQuery的trim方法删除前后空格
				if(content.length<=0 || content=="<br>"){
					alert("发送内容不能为空！");
					$("#content").html("");
					return;
				}
				var uid=$("#userId").attr("data-id");
				var nickname=$(".nickname").html();
				var identity=$("#userId").attr("data-type");
				var sendTime=getDate();
				var imgSrc=src(identity);
				$("#content").html("");
				var message = JSON.stringify({"content":content,"status":status,"uid":uid,"nickname":nickname,"identity":2,"sendTime":sendTime});
				$.ajax({
					url:"http://zbstest.guochengic.com/home/Chat/addChat",
					type:"POST",
					data:{
						content:message
					},
					success: function (res) {
						if(res.code==0){
							var message = JSON.stringify({"content":content,"status":status,"uid":uid,"nickname":nickname,"identity":identity,"sendTime":sendTime,"chatId":res.data.chat_id});
							var myContent=JSON.parse(message);
							var myMessage="<div class='chat_con chat_right' data-id='"+res.data.chat_id+"'>"+
									"<p class='chat_p'><img class='icon_zl' src='"+imgSrc+"'/><span class='zl_name uid' data-id='"+uid+"'>"+nickname+"</span><span class='sendTime'>"+sendTime+"</span></p>"+
									"<span class='yk_con yk_r dis_in'>"+myContent.content+"</span>"+
									"</div>";
							if(status==4){
								flystart(content)
							}else {
								$("#message").append(myMessage);
							}
							$.ajax({
								url:"http://zbstest.guochengic.com/home/Chat/verify",
								type:"POST",
								data:{
									'chat_id':res.data.chat_id,
									'status':1
								},
								success: function (res) {
									console.log(res)
									if(res.code==0){
										ws.send(message);
										var _height=$('#message')[0].scrollHeight;
										$(".messageBox").animate({scrollTop:_height+'px'},500);
									}else {
										$("#errmsg").html(res.msg);
										$("#error").show();
										errorHide();
										return;
									}
								}
							});
						}
					}
				});
			};
			function randoms(){
				var vdcode = document.getElementById('rands');
				vdcode.src="{:captcha_src()}"+"?rand=<?php echo uniqid()?>";
			};
			$(".nav_ul").on("click","li",function () {
				var type=$(this).attr("data-type");
				var id=$(this).attr("data-id");
				$.ajax({
					url:"<?php echo url('index/typeData')?>",
					type:"POST",
					data:{
						"type":type,
						"column_id":id
					},
					success: function (data) {
						$("#popup").html(data);
						$("#popup").show();
					}
				});
			});
			//核心内参列表点击事件
			function article(id,thisli){
				var article_id=id;
				$(".sp12.select").removeClass("select");
				$(thisli).find(".sp12").addClass("select");
				$(this).addClass(".sp12").addClass("select");
				$.ajax({
					url:"http://zbstest.guochengic.com/home/index/getCoreOne",
					type:"POST",
					data:{
						"article_id":article_id
					},
					success: function (res) {
						if(res.code==0){
							var title=res.data.title;
							var attachment=res.data.attachment;
							var attachment_path=res.data.attachment_path;
							var create_time=res.data.create_time;
							var page_view=res.data.page_view;
							var author=res.data.author;
							var summary=escape2Html(res.data.summary);
							$("#content2 .box_r_con h4").html(title);
							$("#content2 .box_r_con .time").html(create_time);
							$("#content2 .box_r_con .author").html(author);
							$("#content2 .box_r_con .pp1").html(summary);
							$("#content2 .box_r_con .in_btn1").attr("href",attachment_path);
						}else {
							$("#errmsg").html(res.msg);
							$("#err").show();
							errorHide();
							return;
						}
					}
				});
			};
			//用户退出
			function userLeave(){
				if(confirm("确认退出么？")){
					$.ajax({
						type:"POST",
						url:"<?php echo url('home/User/dropOut')?>",
						success: function (res) {
							if(res.code==0){
								$("#suc").show();
								$("#sucmsg").html(res.msg);
								successHide();
								location.href="<?php echo url('index/index')?>";
							}else {
								$("#error").show();
								$("#errmsg").html(res.msg);
								errorHide();
							}
						}
					});
				}
			};
			$("#fileIdLive").change(function () {
				if(liveFlag){
					liveFlag=false;
					liveAjaxFileUpload();
				}

			});
			$("#contentLive").keydown(function (event) {
				event = event || window.event;
				var keyCode = event.keyCode;
				//根据keycode判断按下的是哪个键
				if(keyCode=='13'){
					sendLiveMessage();
					event.returnValue = false;
					return false;
				}
			});
			var liveFlag=true;
			function sendLiveMessage(){
				var _content = $("#contentLive").html();
				var content = $.trim(_content.replace(/&nbsp;/ig,' ')); // 用jQuery的trim方法删除前后空格
				if(content.length<=0 || content=="<br>"){
					alert("发送内容不能为空！");
					$("#contentLive").html("");
					return;
				}
				var uid = $("#userId").attr("data-id");
				var nickname=$(".nickname").html();
				var identity=$("#userId").attr("data-type");
				var sendTime=getDate();
				var imgSrc=src(identity);
				$("#contentLive").html("");
				var messageContent = JSON.stringify({"content":content,"status":1,"uid":uid,"nickname":nickname,"identity":identity,"sendTime":sendTime});
				$.ajax({
					url:"http://zbstest.guochengic.com/home/chat/addTextChat",
					type:"POST",
					data:{
						content:messageContent
					},
					success: function (res) {
						console.log(res)
						if(res.code==0){
							var message = JSON.stringify({"content":content,"status":0,"uid":uid,"nickname":nickname,"identity":identity,"sendTime":sendTime});
							var myContent=JSON.parse(message);
							var myMessage="<div class='chat_con chat_right'>"+
									"<p class='chat_p'><img class='icon_zl' src='"+imgSrc+"'/><span class='zl_name uid' data-id='"+uid+"'>"+nickname+"</span><span class='sendTime'>"+sendTime+"</span></p>"+
									"<span class='yk_con yk_r dis_in'>"+myContent.content+"</span>"+
									"</div>";
							$("#messageLive").append(myMessage);
							var _height=$('#messageLive')[0].scrollHeight;
							$(".messageLiveBox").animate({scrollTop:_height+'px'},500);
						}
					}
				});

			};
			function liveAjaxFileUpload() {
				$.ajaxFileUpload
				(
						{
							url: "http://zbstest.guochengic.com/home/upload/upload", //用于文件上传的服务器端请求地址
							secureuri: false, //是否需要安全协议，一般设置为false
							fileElementId: 'fileIdLive', //文件上传域的ID
							dataType:'post',
							success: function (data)  //服务器成功响应处理函数
							{
								liveFlag=true;
								var url = data;
								var content = "<img src='"+url+"'>";
								var uid=$("#userId").attr("data-id");
								var nickname=$(".nickname").html();
								var identity=$("#userId").attr("data-type");
								var sendTime=getDate();
								var imgSrc=src(identity);
								$("#contentLive").html("");
								var message = JSON.stringify({"content":content,"status":1,"uid":uid,"nickname":nickname,"identity":identity,"sendTime":sendTime});
								$.ajax({
									url:"http://zbstest.guochengic.com/home/chat/addTextChat",
									type:"POST",
									data:{
										content:message
									},
									success: function (res) {
										console.log(res)
										if(res.code==0){
											var message = JSON.stringify({"content":content,"status":0,"uid":uid,"nickname":nickname,"identity":identity,"sendTime":sendTime});
											var myContent=JSON.parse(message);
											var myMessage="<div class='chat_con chat_right'>"+
													"<p class='chat_p'><img class='icon_zl' src='"+imgSrc+"'/><span class='zl_name uid' data-id='"+uid+"'>"+nickname+"</span><span class='sendTime'>"+sendTime+"</span></p>"+
													"<span class='yk_con yk_r dis_in'>"+myContent.content+"</span>"+
													"</div>";
											$("#messageLive").append(myMessage);
											var _height=$('#messageLive')[0].scrollHeight;
											$(".messageLiveBox").animate({scrollTop:_height+'px'},500);
										}
									}
								});
							}

						}
				)
				return false;
			}
			//用户登录
			function userLogin(){
				var username=$(".userLogin .mobile").val();
				var password=$(".userLogin .password").val();
				var captcha=$(".userLogin .code").val();
				$.ajax({
					type:"POST",
					url:"http://zbstest.guochengic.com/home/login/login",
					data:{
						"username":username,
						"password":password,
						"captcha":captcha
					},
					success: function (res) {
						if(res.code==0){
							$("#suc").show();
							$("#sucmsg").html(res.msg);
							successHide();
							$(".userLogin").hide();
							$("#userId").attr("data-type",res.data.type);
							save();
							if(res.data.type==2){
								location.href="<?php echo url('index/verify')?>";
							}else {
								location.href="<?php echo url('index/index')?>";
							}
						}else {
							$("#error").show();
							$("#errmsg").html(res.msg);
							errorHide();
							return;
						}
					}
				});
			};
			function lookRecommendSure(){
				var recommendId= $("#content6_integral1").attr("data-id");
				$.ajax({
					url:"http://zbstest.guochengic.com/home/integral/readShare",
					type:"POST",
					data:{
						"shares_id":recommendId
					},
					success: function (res) {
						if(res.code==0){
							$.ajax({
								url:"<?php echo url('index/typeData')?>",
								type:"POST",
								data:{
									"type":2,
									"column_id":2
								},
								success: function (data) {
									console.log(data)
									$("#popup").hide();
									$("#popup").html(data);
									$("#content6").show();
									$("#content6_integral").hide();
									$("#content6_integral1").hide();
									$("#popup").show();
								}
							});
						}else {
							$("#error").show();
							$("#errmsg").html(res.msg);
							errorHide();
							return;
						}
					}
				});
			};

		</script>
	</body>
</html>
